package com.java.demo.controller;

import com.java.demo.enity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;

@Controller
public class UserController {
    @Autowired
    private User user;

    public void printUser() {
        System.out.println(user);
        //修改 User
        User myUser = user;
        myUser.setName("良月初十");
        System.out.println("myUser -> " + myUser);
        System.out.println("user -> " + user);
    }
    @PostConstruct
    public void doPostConstruct() {
        System.out.println("进行初始化： ");
        System.out.println(user.toString());
    }
}
